<?php

class FormBuilder_Display
{
	const REGEX_ATTRIBUTE = ':a(?:ttr(?:ibutes?)?)?';
	const REGEX_CHILDREN  = ':c(?:hild(?:ren)?)?';

	protected $format;
	protected $attributes;
	protected $children;

#------------------------------------------------------------------------------

	public function __construct ($format, $attr = null, $children = null)
	{
		$this->format = $format;

		if (preg_match('/' . self::REGEX_CHILDREN . '/i', $format)) {
			list ($start, $end) = preg_split('/\s*(' . self::REGEX_CHILDREN . ')\s*/i', $s);
			$this->format = array ( 'start' => $start, 'end' => $end );
		}

		$this->setAttributes();
		$this->setChildren();
	}
}

